package com.xiaoxu.intranetweb.mybatisplusSzappdb.controller.compete;

import com.xiaoxu.intranetweb.mybatisplusSzappdb.business.compete.DataScreenBu;
import com.xiaoxu.intranetweb.util.SzResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(value = "/dataScreen")
public class DataScreenController {
    @Autowired
    private DataScreenBu dataScreenBu;

    @GetMapping("/latestWinningBid")
    public SzResult latestWinningBid(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.latestWinningBid(token, plantId);
    }

    @GetMapping("/bidCustomerAnalysis")
    public SzResult bidCustomerAnalysis(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.bidCustomerAnalysis(token, plantId);
    }

    @GetMapping("/winBidCustomerAnalysis")
    public SzResult winBidCustomerAnalysis(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.winBidCustomerAnalysis(token, plantId);
    }

    @GetMapping("/customerAnalysis")
    public SzResult customerAnalysis(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.customerAnalysis(token, plantId);
    }

    @GetMapping("/platFormBiddingDetails")
    public SzResult platFormBiddingDetails(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.platFormBiddingDetails(token, plantId);
    }

    @GetMapping("/basePriceMeanValue")
    public SzResult basePriceMeanValue(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.basePriceMeanValue(token, plantId);
    }

    @GetMapping("/comparisonOfBidPrices")
    public SzResult basePriceTrend(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.comparisonOfBidPrices(token, plantId);
    }

    @GetMapping("/bidWinningPriceTrendChart")
    public SzResult bidWinningPriceTrendChart(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.bidWinningPriceTrendChart(token, plantId);
    }

    @GetMapping("/bidWinningWeightTrendChart")
    public SzResult bidWinningWeightTrendChart(HttpServletRequest request) throws Exception {
        String token = request.getHeader("Authorization");
        String plantId = request.getHeader("Plant-Id");
        return dataScreenBu.bidWinningWeightTrendChart(token, plantId);
    }
}
